package models;

import java.util.regex.Pattern;

import javax.persistence.Entity;
import javax.persistence.Table;

import play.db.jpa.Model;

@Entity
@Table(name="LocalUser")
public class User extends Model{
	
	private static Pattern emailPattern = Pattern.compile("[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[a-zA-Z0-9](?:[\\w-]*[\\w])?");
	
	public String userName;
	public String ip;
	public String machineName;
	public int registered = 0;
	
	public boolean isUserNameAEmail()
	{
		if(userName==null|| userName.trim().length()<=0)
		{
			return false;
		}
		return emailPattern.matcher(userName).matches();
	}
}
